十进制转化为n进制通用
#include<bits/stdc++.h>
using namespace std;

char IntToChar(int target){
    if(target<10){
        return target+'0';
    }else{
        return target-10+'A';
        //如需36进制以上则需自定义
    }
}

void Convert(int n,int x){
    vector<char> answer;
    if(n==0){
        answer.push_back('0');
    }else{
        while(n){
            answer.push_back(IntToChar(n%x));
            n/=x;
        }
    }
    for(int i=answer.size()-1;i>=0;i--){
        printf("%c",answer[i]);
    }
    printf("\n");
}

int main(){
    int n;
    while(scanf("%d",&n)!=EOF){
        Convert(n,16);//16进制
    }
    return 0;
}
